﻿using System;
using System.Windows.Data;
using System.Globalization;

namespace MetroCalendar.Converters
{
    public class RepeatTypeToIntegerConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int integer = -1;

            if (value is RepeatType)
            {
                integer = (int)value;
            }

            return integer;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            RepeatType repeatType = RepeatType.NotRepeated;

            if (value is int)
            {
                repeatType = (RepeatType)value;
            }

            return repeatType;
        }
    }
}
